//---------------------------------------------------------------------------- // File: C3DManager.h // Class: C3DManager [v1] // Type: 3D API System Managment // Author: Ken Anderson // Date: 11/26/04 // OS dependant: N/A // Desc: Main 3D interface that provides access to either the opengl or Direct3d // renderers depending on which one is selected then links the system to the correct // system. All function calls that are common must be routed through here. // // Notes on Class Functionality: // 1) Main Creation & Destruction: These functions are created to initialize, create and destroy // buffers on demand of the 3d system. // // A) Direct3d: Direct3d uses a system of vertex buffers which must be created before any 3D // objects can be rendered. The derived class of D3D should encopasses creating // invalidating, restoring and destroying these vertex buffers when requires of the // in cases such as mode, fullscreen/windowed, adapter and other display changes. Since // // B) OpenGL: OpenGL uses an on demand rendering system where no vertex buffers are required, but are // available. Using simple functions, a vertex or a set of vertices can be rendered // without any initialization, invalidation, restoring or destruction of any extra buffers. // // Secondary Notes: // Source code derived from the Direct3d's needs for intialization and operation, code // will shift & develop to manage both OpenGL & Direct3d. // // Required headers: // 1. D3DManager.h -- Direct3D's render manager. // 2. OGLManager.h -- OpenGL's render manager. //---------------------------------------------------------------------------- #ifndef __C3DMANAGER__ #define __C3DMANAGER__ #include "CRSDefs.h" #include "D3DManager.h" //#include "OGLManager.h" class C3DManager { //private: public: D3DManager* m_pD3D; OGLManager* m_pOGL; RendererType m_Renderer; public: //Constructor & destructor of class. C3DManager(RendererType RT); C3DManager(const C3DManager& manager); ~C3DManager(); C3DERR SetRenderer(RendererType RT); ////////////////////////////// // MAIN C3DMANAGER ROUTINES // ////////////////////////////// C3DERR Create(void** HVWnd); C3DERR Destroy(); /////////////////////////// // DISPLAY MANAGEMENT // /////////////////////////// C3DERR Fullscreen(bool bFullScreen); C3DERR Fullscreen(); C3DERR ResizeDisplay(Rect rc); C3DERR ChangeDisplay(Dword dwHeight, Dword dwWidth, C3DFORMAT ColorDepthFormat, C3DDEVTYPE devtype=C3DDEV_HARDWARE); C3DERR ChangeDisplay(Dword dwHeight, Dword dwWidth, C3DFORMAT ColorDepthFormat, bool bWindowed, C3DDEVTYPE devtype=C3DDEV_HARDWARE); ////////////////////////////// // DISPLAY PROPERTIES // ////////////////////////////// int ReturnCurrModeNum(); C3DERR ReturnCurrModeInfo(Dword& rdwHeight, Dword& rdwWidth, C3DFORMAT& rColorDepth); int ReturnNumModes(); C3DERR ReturnModeInfo(Dword dwModeNum, Dword& rdwHeight, Dword& rdwWidth, C3DFORMAT& rColorDepth); C3DERR SetMode(Dword dwModeNum); bool IsIndex32Capable(); ////////////////////////////// // PAINTING ROUTINES // ////////////////////////////// C3DERR BeginScene(); C3DERR EndScene(); void Clear(); void Present(); ////////////////////////////// // Capabilities // ////////////////////////////// C3DERR GetDeviceCaps(C3DCAPS& rCaps); ////////////////////////////// // TRANSFORM ROUTINES // ////////////////////////////// C3DERR SetTransform(C3DTransformState TS, SC3DMatrix4& rMatrix); C3DERR GetTransform(C3DTransformState TS, SC3DMatrix4& rMatrix); ////////////////////////////// // VIEWPORT ROUTINES // ////////////////////////////// C3DERR SetViewport(SC3DViewport& rVP); C3DERR GetViewport(SC3DViewport& rVP); ////////////////////////////// // RENDER STATE // ////////////////////////////// C3DERR SetRenderState(C3DRenderState RS, Dword dwValue); C3DERR SetTextureStageState(Byte byStage, C3DTextureStageState tss, Dword dwValue); C3DERR ClearTexture(Byte byStage); ////////////////////////////// // RENDER BANK BUFFERS // ////////////////////////////// C3DERR ProcessVertexBuffer(HRBE hVertSlot); C3DERR ProcessTextureBuffer(HRBE hTextSlot); C3DERR ProcessIndexBuffer(HRBE hIndxSlot); void DestroyVertexBuffer(HRBE hVertSlot); void DestroyTextureBuffer(HRBE hTextSlot); void DestroyIndexBuffer(HRBE hIndxSlot); //TO be removed C3DERR UploadBanks(); }; #endif